<template>
    <div>
<van-tabs v-model:active="active">
  <van-tab title="全部">
    <div>
        <div v-for="item in shop">
            <img :src="item.goods_big_logo" alt="" @click="pushdetail">
            <p>{{item.text}}</p>
            <p>{{item.goods_price}}</p>
        </div>
    </div>
  </van-tab>
  <van-tab title="尊享二手车">
    <div v-for="item in shop">
            <img :src="item.goods_big_logo" alt="" @click="pushdetail">
            <p>{{item.text}}</p>
            <p>{{item.goods_price}}</p>
        </div>
  </van-tab>
  <van-tab title="常规二手车">
    <div v-for="item in shop">
            <img :src="item.goods_big_logo" alt="" @click="pushdetail">
            <p>{{item.text}}</p>
            <p>{{item.goods_price}}</p>
        </div>
  </van-tab>
</van-tabs>

    </div>
</template>

<script setup>
import {ref} from 'vue'
import axios from '../request'
import {useRouter} from 'vue-router'
const router=useRouter()
const shop=ref([])
const shopinit=()=>{
    axios.get('https://api-hmugo-web.itheima.net/api/public/v1/goods/search').then((res)=>{
        shop.value=res
    })
}
shopinit()
//跳转
const pushdetail=()=>{
    router.push({
        path:'/detail'
    })
}
</script>

<style lang="scss" scoped>

</style>